package engine;

import java.util.Collection;
import java.util.LinkedList;

/**
 * Keeps track and allows user tweaking of the constants/parameters used by the
 * models.
 *
 * <p>When writting a model, please register the parameters here so they may be
 * used on the interface.</p>
 *
 * @author Ricardo Cruz {@literal <ricardo.pdm.cruz@gmail.com>}
 * @since  2014-11-12
 */
public class Parameters
{
	private static final Parameters singleton = new Parameters();

	@SuppressWarnings("rawtypes")
	private LinkedList<Parameter> parameters = new LinkedList<Parameter>();

	/**
	 * Internal usage only. When creating a {@link Parameter}, it automatically
	 * registers it self for central retrieval.
	 * @param p parameter to add
	 */
	@SuppressWarnings("rawtypes")
	public static void register(Parameter p) {
		singleton.parameters.add(p);
	}

	/**
	 * Returns complete listing of the model parameters for user displaying and
	 * control.
	 * @return the list of parameters
	 */
	@SuppressWarnings("rawtypes")
	public static Collection<Parameter> getParameters() {
		return singleton.parameters;
	}
}
